﻿param($servers,$exportDirectory,$exportFilePrefix)

$files=Get-content .\CoreFiles.txt


foreach($server in $servers)
{
    foreach($file in $files)
    {
        Get-ChildItem ("\\$server\" + $file) -ErrorAction SilentlyContinue| select @{Expression={$server};Label="ComputerName"},Name,@{Expression={$_.VersionInfo.FileMajorPart.ToString()+"."+$_.VersionInfo.FileMinorPart.ToString()+"."+$_.VersionInfo.FileBuildPart.ToString()+"."+$_.VersionInfo.FilePrivatePart.ToString()};Label="ProductVersion"},@{Expression={$_.VersionInfo.FileDescription};Label="FileDescription"} | Export-Csv -Path  $exportDirectory\$exportFilePrefix`_CoreFiles_Information.csv -NoTypeInformation -Append
    }
}